Skip to content

Commit

Permalink
fixed bug affecting user-defined functions with more than one argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dktr0 committed Oct 2, 2024
1 parent a34c4a0 commit 024f79c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
36 changes: 18 additions & 18 deletions punctual.js

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions src/Parser.purs
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,29 @@ numberSignalSignalSignal p f = pure $ abcd p f


embedLambdas :: Position -> List String -> Expression -> P Value
embedLambdas _ Nil e = parseExpression e
embedLambdas p (x:xs) e = pure $ ValueFunction p (\v -> embedLambda x v (embedLambdas (valuePosition v) xs e))
embedLambdas p ks e = do
cachedS <- get
a <- _embedLambdas p ks e
put cachedS
pure a

_embedLambdas :: Position -> List String -> Expression -> P Value
_embedLambdas _ Nil e = parseExpression e
_embedLambdas p (k:ks) e = pure $ ValueFunction p (\v -> do
s <- get
put $ Map.insert k v s
embedLambdas (valuePosition v) ks e
)

{-
embedLambda :: forall a. String -> Value -> P a -> P a
embedLambda k v p = do
cachedS <- get
put $ Map.insert k v cachedS
a <- p
put cachedS
pure a
-}

importLibrary :: Position -> Value -> P Value
importLibrary p v = do
Expand Down

0 comments on commit 024f79c

Please sign in to comment.