Good day -

I'd still love to hear some explanation about how
the global '(pico~args)' symbol gets blown out
by a function parameter named 'args', not within
that function, but within a function it calls.

Also, how does one define new piLog Predicates ?

 I'm trying to create a Database of APKs :

(class +APK +Entity)
# APK POC Package Database Class
(rel   apk (+Need +Idx +String)) # APK Path
(rel   app (+Need +Idx +String)) # APK Package
(rel   aid (+Need +Idx +String)) # APK Application ID
(rel   ino (+Need +Idx +Number)) # FS  Inode of APK on SharePoint
filesystem (UUID)
(rel   flv (+Need +Idx +String)) # APK Build Flavor
(rel   bty (+Need +Idx +String)) # APK Build Type
(rel   vrn (+Need +Idx +Number)) # APK VersionCode
(rel   vrs (+Need +Idx +String)) # APK VersionName
(rel   gin (+Idx +String))       # APK GIT Info String
(rel   dbg (+Idx +Bool))   # APK has Debug Logging enabled
(rel   blt (+Need +Idx +Number)) # APK BuildTime
(rel   bls (+Need +Idx +String)) # APK BuildTimeString
(rel   ctm (+Need +Idx +Number)) # APK Creation Time
(rel   mtm (+Need +Idx +String)) # APK Modification Time
(rel   AB> (*Idx +Number)) # APK MinSdkVersion (Android ABI #)
(rel   AB< (*Idx +Number)) # APK MaxSdkVersion (Android ABI #)
(rel   AB@ (*Idx +Number)) # APK TargetSdkVersion (Android ABI #)
(rel   AB$ (*Idx +Number)) # APK CompileSdkVersion (Android ABI #)


and define a query :


(de apks ( Flv Ver Blt Abi Mtm )
 (if (or (not (bool Flv)) (not (str? Flv))
         (not (bool Ver)) (not (num? Ver))
         (not (bool Blt)) (not (num? Blt))
         (not (bool Abi)) (not (num? Abi))
     )
  (throw (pack "apks: Invalid Parameters: flv:" (sym Flv) " vrn:" (sym
Ver) " Mtm:" (sym Mtm) " Abi:" (sym Abi)))
  (if (not (bool Mtm))
   (symbols '(APK pico)
   (solve
    (quote
     @FLV Flv
     @VER (cons Ver)
     @BLT (cons Blt)
     @AB> (cons NIL Abi)
     @AB< (cons Abi)
     (select (@APK)
      ((flv +APK @FLV)
       (vrn +APK @VER)
       (blt +APK @BLT)
       (AB> +APK @AB>)
       (AB< +APK @AB<)
      )
      (same  @FLV @APK flv)
      (range @VER @APK vrn)
      (range @BLT @APK blt)
      (range @AB> @APK AB>)
      (range @AB< @APK AB<)
     )
    ) @APK
   ))
   (symbols '(APK pico)
   (solve
    (quote
     @FLV Flv
     @VER (cons Ver)
     @BLT (cons Blt)
     @AB> (cons NIL Abi)
     @AB< (cons Abi)
     @MTM (cons Mtm)
     (select (@APK)
      ( (flv +APK @FLV)
        (vrn +APK @VER)
        (blt +APK @BLT)
        (mtm +APK @MTM)
        (AB> +APK @AB>)
        (AB< +APK @AB<)
      )
      (same  @FLV @APK flv)
      (range @VER @APK vrn)
      (range @BLT @APK blt)
      (range @MTM @APK mtm)
      (range @AB> @APK AB>)
      (range @AB< @APK AB<)
     )
    ) @APK
   ))
  )
 )
)


to select APKs which :
 o have a given 'flv' (flavor) attribute == Flv
 o have a version >= Ver
 o have a min api # <= Abi
 o have a max api # >= Abi
 o have a build time >= Blt
 o have a modification time >= Mtm

but the above query always returns NIL , I think because
many APKs do not specify any 'maxSdkVersion', so get
'AB<' set to 0 :
I want to define a piLog Predicate that says:
  (or ( (=0 @APK AB<) (range @AB< @APK AB<))
how would I do this?

Thanks, Best Regards,
Jason




On 07/05/2022, Jason Vas Dias <jason.vas.d...@gmail.com> wrote:
> Good day Alex, picoLisp list -
>
>   Why does declaring a parameter named 'args', in a function that does
>   NOT use the '(args)' call, break things severely ?
>
>   I had a function that does NOT use the built-in 'args, but which
>   declared a parameter named 'args :
>
>     (de a ( fun data args )
>      (let
>       ( (flg list x) args ) # destructuring bind
>       (prog ...
>        # eventually, fun gets called with unpacked args:
>        (fun data flg list x)
>       )
>      )
>     )
>
>     Then eventually 'fun calls a function that calls '(args) :
>    '(request!
>      '(+myDbCls) ...
>     )
>     which DOES use args, at which point I got an error:
>
>     !? ((0 NIL 16661165511231956559 (15935676839705835219
> (12638994734423517827 ...
>     0 -- Variable expected
>
>   Renaming the parameter 'ars (or 'as :-) ) fixed the problem.
>
>   Why ?
>
>   I thought parameters and '(let ..) variables are in their own
>   dynamic lexical scope, so that even if the 'args call is hidden
>   in the 'a function, if 'a calls another function 'fun, and that
>   calls a function which calls 'request!, the binding of 'args
>   in request cannot possibly be affected by the binding of 'args
>   in 'a. This turns out to be incorrect ! Where am I going wrong ?
>
>   This took me a LONG time to find. My only clue was that 'list does
>   look like :
>    ((0 NIL 16661165511231956559 (15935676839705835219 (12638994734423517827
> ...
>
>   Any suggestions as to exactly how the binding of 'args in 'a gets
>   called by 'request! would be much appreciated.
>
> Thank You & Best Regards,
> Jason
>

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to